package com.huaxin.device.models;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 断路器用电数据
 */
@Data
@TableName("device_readings_circuit_breaker")
public class DeviceReadingCircuitBreaker {

    /**
     * 唯一ID（UUID）- 主键
     */
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 自增序列号（唯一索引，非主键）
     */
    @TableField(value = "auto_id")
    private Long autoId;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 组织ID
     */
    @TableField(value = "org_id")
    private String orgId;

    /**
     * 设备实例ID
     */
    @TableField(value = "device_id")
    @Schema(description = "设备实例ID", example = "d123e456-789a-bcde-f012-3456789abcde")
    private String deviceId;

    /**
     * 电压 (V)
     */
    @TableField(value = "voltage")
    @Schema(description = "电压 (V)", example = "220.50")
    private BigDecimal voltage;

    /**
     * 电流 (A)
     */
    @TableField(value = "current")
    @Schema(description = "电流 (A)", example = "15.60")
    private BigDecimal current;

    /**
     * 功率 (kW)
     */
    @TableField(value = "power")
    @Schema(description = "功率 (kW)", example = "3.43")
    private BigDecimal power;

    /**
     * 今日用电量 (kWh)
     */
    @TableField(value = "energy_today")
    @Schema(description = "今日用电量 (kWh)", example = "28.70")
    private BigDecimal energyToday;

    /**
     * 功率因数
     */
    @TableField(value = "power_factor")
    @Schema(description = "功率因数", example = "0.95")
    private BigDecimal powerFactor;
}